package com.lzh.others.basejava.Thread_21.bilibili_course_thread.course_08;

import com.lzh.others.basejava.Thread_21.utils.SmallTool;

import java.util.concurrent.TimeUnit;

/**
 * InterruptedException异常会直接终止本次线程
 *
 * @author LiuZiHao
 * @date 创建时间:2023年05月26日 17:03:38
 */
public class ThreadStateTest {
    public static void main(String[] args) {
        Thread thread = new Thread();
        System.out.println("1- " + thread.getState());
        thread.start();
        System.out.println("2- " + thread.getState());
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            SmallTool.printTimeAndThread("产生中断" + e.getMessage());
        }
        System.out.println("3- " + thread.getState());
    }
}
